import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

/**
 * 会员套餐实体
 */
@Entity({ name: 'membership_packages', comment: '会员套餐表' })
export class MembershipPackage {
  @ApiProperty({ description: '套餐ID' })
  @PrimaryGeneratedColumn({ comment: '套餐ID' })
  id: number;

  @ApiProperty({ description: '套餐名称' })
  @Column({ 
    length: 100,
    comment: '套餐名称' 
  })
  name: string;

  @ApiProperty({ description: '套餐价格（单位：分）' })
  @Column({ 
    type: 'int',
    comment: '套餐价格，单位分，例如1000表示￥10' 
  })
  price: number;

  @ApiProperty({ description: '套餐时长（天数）' })
  @Column({ 
    type: 'int',
    comment: '套餐时长，单位天，例如30、90、180、365' 
  })
  durationDays: number;

  @ApiProperty({ description: '套餐等级' })
  @Column({ 
    type: 'int',
    default: 1,
    comment: '套餐等级，数字越大等级越高' 
  })
  level: number;

  @ApiProperty({ description: '套餐描述' })
  @Column({ 
    type: 'text',
    nullable: true,
    comment: '套餐详细描述' 
  })
  description?: string;

  @ApiProperty({ description: '是否启用' })
  @Column({ 
    default: true,
    comment: '套餐是否启用' 
  })
  isActive: boolean;

  @ApiProperty({ description: '创建时间' })
  @CreateDateColumn({ comment: '记录创建时间' })
  createdAt: Date;

  @ApiProperty({ description: '更新时间' })
  @UpdateDateColumn({ comment: '记录更新时间' })
  updatedAt: Date;
}